package top.wanzc.java.basic.jdk9.to17.feature;

import java.util.Arrays;

/**
 * 
 * @className: LocalVariableTypeInference
 * @comment: 局部变量自动推断
 * @date: 2024年2月9日 下午4:33:58 
 *
 * @author zhengchong.wan
 * @since V1.0.0
 */

@FunctionalInterface
interface Mapper<A,B>{
       B map(A a);
}

public class LocalVariableTypeInference {

	public static void main(String[] args) {
		var a = 1;
		var b = "2";
		System.out.println(a + 2);
		System.out.println(b.length());
		var list = Arrays.asList("hello","world");
        for (var o : list) {
            System.out.println(o);
        }
        
        Mapper<String, Integer> string2int1 = ma -> ma.length();
        Mapper<String, Integer> string2int2 = (var ma) -> ma.length();
	}

}
